-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8354464: Additional cleanup setting up native.encoding #24607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8354464: Additional cleanup setting up native.encoding #24607
Conversation
👋 Welcome back smarks! A progress list of the required criteria for merging this PR into |
@stuart-marks This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 56 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
@stuart-marks The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clean-up, Stuart. Looks good to me.
PUTPROP(propArray, _native_encoding_NDX, sprops->encoding); | ||
#else | ||
PUTPROP(propArray, _native_encoding_NDX, sprops->sun_jnu_encoding); | ||
#endif | ||
PUTPROP(propArray, _sun_jnu_encoding_NDX, sprops->sun_jnu_encoding); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we now got rid of platform depenence here, would it make sense to perform non-null assertion in Java level here? I remember in the last PR we added assert
in platform C code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Java level
-> Platform independent C level
Sorry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've gone through this, I don't see any issues.
@@ -660,22 +660,19 @@ GetJavaProperties(JNIEnv* env) | |||
&sprops.format_script, | |||
&sprops.format_country, | |||
&sprops.format_variant, | |||
&sprops.encoding); | |||
&format_encoding_unused); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A cleaner change would be to modify SetupI18nProps to remove the encoding argument.
SetupI18nProps is a file local static function, there are no other uses.
And drop the dummy variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main focus of this commit is to straighten out the logic between the platform-specific and platform-independent layers.
In the previous state of this file, tracing the origin of the properties on Windows, I ended up following the origin of sprops.encoding all the way through SetupI18nProps, only to find that was ignored entirely at the platform-independent layer. So this change is an improvement in that it clarifies where sprops.encoding comes from, and that SetupI18nProps does some computations that end up being thrown away instead of being stored into a shared data structure that's eventually ignored.
Of course that path is dead code and could be removed without changing the behavior. But this code has a tortured history and it's not entirely clear that it's correct in its current state. In fact @naotoj considered making some changes in this logic JDK-8352917 but decided against it. However it seems like a possibility that we might revisit this?
Also note that we're now talking about how Windows gets its encoding information from the OS, and not how encoding information is transmitted up through the layers into Java properties, which is the focus of this cleanup.
Anyway I'd like to hear from @naotoj on this. If we're certain the extra stuff in SetupI18nProps is useless, we should clean it up now. But if there might be a use for this information -- maybe stdin.encoding? -- then perhaps it's better to leave it as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I belive they can be removed as they are no where used (and I don't think it will be used for stdin.encoding
either) So I prefer removing those unused code now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I've done so. Now testing on Windows....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(CI run built and passed all tests, including on Windows.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
/integrate |
Going to push as commit 7b06188.
Your commit was automatically rebased without conflicts. |
@stuart-marks Pushed as commit 7b06188. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
I probably would have waited to integrate until the person who requested changes had a chance to re-approve. |
Sorry, @AlanBateman and @naotoj and I have been over this code a bunch of times, and I thought their reviews were sufficient. |
Remove the #ifdef MACOSX from platform-independent System.c, which (on Mac) sets native.encoding from sprops.encoding or (on non-Mac Unix and Windows) sets native.encoding from sprops.sun_jnu_encoding. After this removal, the native.encoding property will be set from sprops.encoding and the sun.jnu.encoding property will be set from sprops.sun_jnu_encoding.
Change the windows java_props_md.c so that it initializes sprops.sun_jnu_encoding and then copies that value to sprops.encoding. Previously, sprops.encoding was initialized with data from other Windows APIs, but this value was ignored by platform-independent code, which was kind of confusing.
There are no changes to the Unix (Mac & non-Mac) platform-specific code. It already has code to set sprops.encoding and sprops.sun_jnu_encoding properly, including macOS-specific code to set the latter to UTF-8 unconditionally.
There should be no behavior changes on any platform.
I changed variable names in windows/java_props_md.c to make it clear that the values stored into them are unused. Of course there are other possibilities here, such as changing the interface to SetupI18nProps(). I'm open to suggestions.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24607/head:pull/24607
$ git checkout pull/24607
Update a local copy of the PR:
$ git checkout pull/24607
$ git pull https://git.openjdk.org/jdk.git pull/24607/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 24607
View PR using the GUI difftool:
$ git pr show -t 24607
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24607.diff
Using Webrev
Link to Webrev Comment